<template>
  <div class="all-job-resume">
    <div class="all-job-resume-head">
      <el-col :span="24">
        <span class="all-job-resume-line"></span>
        职称
      </el-col>
    </div>
    <div class="bright-tag">
      <el-tag
        closable
        v-for="(item, index) in data.titleName"
        :key="index"
        @close="handleClose(item)"
      >{{item}}</el-tag>
    </div>
    <div style="padding:0 0 20px 0;">
      <el-checkbox-group v-model="data.titleName" @change="doUpdate">
        <el-checkbox
          v-for="(item, index) in technicalType"
          :key="index"
          :label="item.content"
          :value="item.content"
          border
        ></el-checkbox>
      </el-checkbox-group>
    </div>
  </div>
</template>

<script>
import { constants } from 'crypto'
export default {
  props: ['technicalType', 'data'],
  data() {
    return {
      params: ''
    }
  },
  methods: {
    handleClose(val) {
      this.data.titleName.splice(this.data.titleName.indexOf(val), 1)
      this.doUpdate()
    },
    check() {
      if (this.data.titleName.length > 3) {
        _g.message('职称不能超过3个', 'warning')
        return false
      }
      return true
    },
    doUpdate() {
      if (this.data.titleName.length > 1) {
        this.data.titleName.pop()
        _g.message('职称只能选择1个', 'warning')
        return false
      } else {
        this.params = this.data.titleName.join(',')
        //console.log(this.params)
        _g.apiPost('/talent/updateTitle.do', {
          titleName: this.params
        }).then(res => {
          //_g.toMessage(res)
          this.$emit('on-pitch', true)
        })
      }
    }
  },
  mounted() {},
  components: {}
}
</script>

<style lang="scss" scoped>
</style>
